import { useTable, LIST_TYPE } from '@crud/index';
import { getPromotionList } from '@/api/crm-agency/kgj/lecturer';

// 查询
const statusMap: Record<string, any> = {
  1: '使用中',
  2: '已失效'
};
// 表格
export const useTableList = (options: any = {}) => {
  const columns: any = [
    { label: '推广链接', prop: 'extend_url', minWidth: 160, tooltip: true, fixed: 'left' },
    { label: '兑换时长', prop: 'vip_type', minWidth: 120 },
    { label: '领取用户', prop: 'get_user', minWidth: 120 },
    { label: '领取时间', prop: 'get_time', minWidth: 177, type: 'dateTime' },
    { label: '链接状态', prop: 'status', minWidth: 120, render: (s: any) => statusMap[s.row.status] }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.AGENCY,
    params: {
      agent_id: undefined
    },
    columns: columns,
    getList: getPromotionList
  });
};
